<?php

/* * 
 * 文章模型
 */
namespace Home\Model;
use Common\Model\CommonModel;



class ArticleModel extends CommonModel {


     
    public function get_list($data){
    	
    	$cates=F("Cates");

    	$cache = ( int ) $data [cache];
    	
    
    	$limit = $data ['limit']?$data ['limit']:0;
    
    	$num = $data ['num'] ? $data ['num'] : 20;
    	
    	$where ['status'] = array ("EQ",1 	);
    	
    	if (isset ( $data ['where'] ) && $s=$data ['where']) {
    	$where['_complex'] = $s;
    		
    	}
    	$order = empty ( $data ['order'] ) ? "top DESC,listorder DESC,updatetime desc" : $data ['order'];
    	
    	if ($cache) {
    		$result = $this->field('content',true)->cache ( true, $cache )->where ( $where )->limit ( $limit,$num )->order ( $order )->select ();
    	} else {
    		$result = $this->field('content',true)->where ( $where )->limit ( $limit,$num )->order ( $order )->select ();
    	}
    	
    	foreach ($result as $key=>$v){
    		
    		$result[$key][catname]=$cates[$v[catid]][name];
    		$result[$key][caturl]=$cates[$v[catid]][url];
    		
    		
    	}
    	//print_r($result);
    	
    	return $result;
    	
    	
    	
    	
    }
    
    
 
    
    

	}

?>